{extend name="layout" /}
{block name="body"}
<!--页面主要内容-->
<div class="row">
	<div class="col-lg-12">
		<div class="card">
			<div class="card-body">
				<form action="" method="post">
					<div class="form-group">
						<label for="appmsg">公告内容</label>
						<input type="text" class="form-control" id="appmsg" name="appmsg" value=""
							placeholder="请输入公告内容">
					</div>
					<button type="button" onclick="updateappmsg()"
						class="btn btn-w-sm btn-primary mb-2">发布</button>
					<button type="button" class="btn btn-default mb-2"
						onclick="javascript:history.back(-1);return false;">返 回
					</button>
				</form>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="js"}
<script>
    function updateappmsg() {
        var l = $('body').lyearloading({
            opacity: 0.2,
            spinnerSize: 'lg',
            spinnerText: '后台处理中，请稍后...',
            textColorClass: 'text-info',
            spinnerColorClass: 'text-info'
        });
    	var appmsg = $.trim($("#appmsg").val());
        $.ajax({
            type: "POST",
            url: "{:url('app/appmsg')}",
            data: {
                appmsg:appmsg
            },
            dataType: "json",
            success: function (data) {
                setTimeout(function () {
                    l.destroy();
                }, 1e3)
                if (data.code == 1) {
                    notify.success(data.msg);
                } else {
                    notify.error(data.msg);
                }
            },
            error: function () {
                l.destroy();
                notify.error("系统错误");
            }
        })
    }
</script>
{/block}